# Makefile
# author: dipina@eside.deusto.es
CC=g++
LDFLAGS=-L../util -lm -lpthread -lesidesocket -lesidethread -lesidesqlite
INCLUDE=-I../util

main: EchoTcpListener EchoTcpClient EchoTcpClientNew NameServer NameClient PotatoeTcpListener PotatoeTcpClient

EchoTcpListener: EchoServerThread.o EchoTcpListener.o
	$(CC) EchoServerThread.o EchoTcpListener.o $(LDFLAGS) -o EchoTcpListener

EchoTcpClient: EchoTcpClient.o
	$(CC) EchoTcpClient.o $(LDFLAGS) -o EchoTcpClient

EchoTcpClientNew: EchoTcpClientNew.o
	$(CC) EchoTcpClientNew.o $(LDFLAGS) -o EchoTcpClientNew

NameServer: NameServer.o
	$(CC) NameServer.o $(LDFLAGS) -o NameServer

NameClient: NameClient.o
	$(CC) NameClient.o $(LDFLAGS) -o NameClient

PotatoeTcpListener: PotatoeServerThread.o PotatoeTcpListener.o
	$(CC) PotatoeServerThread.o PotatoeTcpListener.o $(LDFLAGS) -o PotatoeTcpListener

PotatoeTcpClient: PotatoeTcpClient.o
	$(CC) PotatoeTcpClient.o $(LDFLAGS) -o PotatoeTcpClient

EchoServerThread.o: EchoServerThread.cc EchoServerThread.h
	$(CC) $(INCLUDE) -c EchoServerThread.cc

EchoTcpListener.o: EchoTcpListener.cc
	$(CC) $(INCLUDE) -c EchoTcpListener.cc

EchoTcpClient.o: EchoTcpClient.cc
	$(CC) $(INCLUDE) -c EchoTcpClient.cc

EchoTcpClientNew.o: EchoTcpClientNew.cc
	$(CC) $(INCLUDE) -c EchoTcpClientNew.cc

NameServer.o: NameServer.cc NameServer.h
	$(CC) $(INCLUDE) -c NameServer.cc

NameClient.o: NameClient.cc 
	$(CC) $(INCLUDE) -c NameClient.cc

PotatoeServerThread.o: PotatoeServerThread.cc PotatoeServerThread.h
	$(CC) $(INCLUDE) -c PotatoeServerThread.cc

PotatoeTcpListener.o: PotatoeTcpListener.cc
	$(CC) $(INCLUDE) -c PotatoeTcpListener.cc

PotatoeTcpClient.o: PotatoeTcpClient.cc
	$(CC) $(INCLUDE) -c PotatoeTcpClient.cc

clean:
	rm *.o
	rm EchoTcpListener EchoTcpClient EchoTcpClientNew NameServer NameClient PotatoeTcpListener PotatoeTcpClient
	rm *.exe
